package com.BraveY.Demo04;

import java.util.Scanner;

public class Demo02 {
    public static void main(String[] args) {
        Scanner S = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String str = S.nextLine();
        int bigZ = 0;
        int smallZ = 0;
        int num = 0;
        for(int i=0; i<str.length(); i++) {
            char ch = str.charAt(i);
            // 判断该字符属于哪种类型，然后对应类型的统计变量+1
            if (ch >= 'a' && ch <= 'z') {
                smallZ++;
            } else if (ch >= '0' && ch <= '9') {
                num++;
            } else if(ch >= 'A' && ch <= 'A'){
                bigZ++;
            }
        }
        System.out.println("大写英文字母：" + bigZ + "个");
        System.out.println("小写英文字母：" + smallZ + "个");
        System.out.println("数字：" + num + "个");

    }
}
